//
//  PGoodDetailCell.m
//  yigou
//
//  Created by wangdianlei on 2017/1/19.
//  Copyright © 2017年 hanyiwang. All rights reserved.
//

#import "PGoodDetailCell.h"
#import "ChooseGoodTypeViewController.h"
#import "MyAddTribeListViewController.h"

@implementation PGoodDetailCell

- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self name:MSGSELECTTYPE object:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:MSGSELECTTRIBE object:nil];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    self.count = 1;
    [DataCenter sharedDataCenter].detailType = PGoodDetailYKJ;
    self.addHeight = 150;
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(choosetype:) name:MSGSELECTTYPE object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(choosetribe:) name:MSGSELECTTRIBE object:nil];
    
    // Initialization code
    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 12)];
    line.backgroundColor = [UIColor colorWithHexString:@"E9E9F1"];;
    [self.contentView addSubview:line];
    
    self.detailView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 420)];
    self.detailView.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.detailView];
    
    [self makeAddView];
    
    UIView *line1 = [[UIView alloc] initWithFrame:CGRectMake(12, 119, ScreenWidth - 24, 1)];
    line1.backgroundColor = LineColor;
    [self.contentView addSubview:line1];
    UIView *line2 = [[UIView alloc] initWithFrame:CGRectMake(12, 119 + 50, ScreenWidth - 24, 1)];
    line2.backgroundColor = LineColor;
    [self.detailView addSubview:line2];
    UIView *line3 = [[UIView alloc] initWithFrame:CGRectMake(12, 119 + 50 * 2, ScreenWidth - 24, 1)];
    line3.backgroundColor = LineColor;
    [self.detailView addSubview:line3];
    UIView *line4 = [[UIView alloc] initWithFrame:CGRectMake(12, 119 + 50 * 3, ScreenWidth - 24, 1)];
    line4.backgroundColor = LineColor;
    [self.detailView addSubview:line4];
    UIView *line5 = [[UIView alloc] initWithFrame:CGRectMake(12, 119 + 50 * 5, ScreenWidth - 24, 1)];
    line5.backgroundColor = LineColor;
    [self.detailView addSubview:line5];
    UIView *line6 = [[UIView alloc] initWithFrame:CGRectMake(12, 119 + 50 * 6, ScreenWidth - 24, 1)];
    line6.backgroundColor = LineColor;
    [self.detailView addSubview:line6];
    
    UIView *linebg = [[UIView alloc] initWithFrame:CGRectMake(20, 25, ScreenWidth - 40, 40)];
    linebg.backgroundColor = LineColor;
    linebg.layer.masksToBounds = YES;
    linebg.layer.cornerRadius = 20.f;
    [self.contentView addSubview:linebg];
    linebg.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickYKJ)];
    tap.numberOfTapsRequired = 1;
    [linebg addGestureRecognizer:tap];
    
    self.buttonykj = [UIButton buttonWithType:UIButtonTypeCustom];
    self.buttonykj.frame = CGRectMake(20, 25, 40, 40);
    self.buttonykj.backgroundColor = QINGColor;
    self.buttonykj.layer.masksToBounds = YES;
    self.buttonykj.layer.cornerRadius = 20;
    //[self.buttonykj setTitle:@"请选择作品分类" forState:UIControlStateNormal];
    self.buttonykj.titleLabel.font = [UIFont systemFontOfSize:15];
    self.buttonykj.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
    //[self.buttonykj setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.contentView addSubview:self.buttonykj];
    [self.buttonykj addTarget:self action:@selector(clickYKJ) forControlEvents:UIControlEventTouchUpInside];
    
    self.ykjLabel = [[UILabel alloc] initWithFrame:CGRectMake(12 + 6, 70, 50, 50)];
    self.ykjLabel.text = @"一口价";
    self.ykjLabel.font = [FontTool fontWithSize:15];
    self.ykjLabel.textColor = [UIColor blackColor];
    self.ykjLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.ykjLabel];
    
    self.pmLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth - 24 - 50, 70, 50, 50)];
    self.pmLabel.text = @"拍卖";
    self.pmLabel.font = [FontTool fontWithSize:15];
    self.pmLabel.textColor = [UIColor lightGrayColor];
    self.pmLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.pmLabel];
    
    UILabel *price = [[UILabel alloc] initWithFrame:CGRectMake(12, 120, 50, 50)];
    price.text = @"价格:";
    price.font = [FontTool fontWithSize:15];
    price.textColor = [UIColor blackColor];
    price.textAlignment = NSTextAlignmentCenter;
    [self.detailView addSubview:price];
    
    self.tfprice =  [[UITextField alloc] initWithFrame:CGRectMake(12 + 50, 120, ScreenWidth - 12 - 12 - 50, 50)];
    self.tfprice.placeholder =@"";
    self.tfprice.textAlignment = NSTextAlignmentLeft;
    self.tfprice.font = [UIFont systemFontOfSize:15];
    self.tfprice.delegate = self;
    self.tfprice.keyboardType = UIKeyboardTypeNumberPad;
    [self.detailView addSubview:self.tfprice];
    
    UILabel *catgory = [[UILabel alloc] initWithFrame:CGRectMake(12, 170, 50, 50)];
    catgory.text = @"分类:";
    catgory.font = [FontTool fontWithSize:15];
    catgory.textColor = [UIColor blackColor];
    catgory.textAlignment = NSTextAlignmentCenter;
    [self.detailView addSubview:catgory];
    
    UIImageView *arrow2 = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth - 18 - 24, 170 + 16, 18, 18)];
    arrow2.image = [UIImage imageNamed:@"rightarrow"];
    [self.detailView addSubview:arrow2];
    
    self.buttonfenlei = [UIButton buttonWithType:UIButtonTypeCustom];
    self.buttonfenlei.frame = CGRectMake(ScreenWidth - 24 - 18 - 140, 170, 140, 50);
    [self.buttonfenlei setTitle:@"请选择作品分类" forState:UIControlStateNormal];
    self.buttonfenlei.titleLabel.font = [UIFont systemFontOfSize:15];
    self.buttonfenlei.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
    [self.buttonfenlei setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.buttonfenlei addTarget:self action:@selector(clickFenlei) forControlEvents:UIControlEventTouchUpInside];
    [self.detailView addSubview:self.buttonfenlei];
    
    UILabel *transport = [[UILabel alloc] initWithFrame:CGRectMake(12, 220, 50, 50)];
    transport.text = @"运费:";
    transport.font = [FontTool fontWithSize:15];
    transport.textColor = [UIColor blackColor];
    transport.textAlignment = NSTextAlignmentCenter;
    [self.detailView addSubview:transport];
    
    self.buttonyf = [UIButton buttonWithType:UIButtonTypeCustom];
    self.buttonyf.frame = CGRectMake(12 + 50 + 20, 220, 100, 50);
    [self.buttonyf setTitle:@"包邮" forState:UIControlStateNormal];
    self.buttonyf.titleLabel.font = [UIFont systemFontOfSize:15];
    self.buttonyf.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.buttonyf setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.buttonyf setImage:[UIImage imageNamed:@"选择默认地址图标"] forState:UIControlStateNormal];
    [self.buttonyf addTarget:self action:@selector(clickBaoyou) forControlEvents:UIControlEventTouchUpInside];
    [self.detailView addSubview:self.buttonyf];
    
    self.buttonyfz = [UIButton buttonWithType:UIButtonTypeCustom];
    self.buttonyfz.frame = CGRectMake(12 + 50 + 20 + 100 + 20, 220 + 15, 20, 20);
    [self.buttonyfz setImage:[UIImage imageNamed:@"nocheck"] forState:UIControlStateNormal];
    [self.buttonyfz addTarget:self action:@selector(clickZdyYunfei) forControlEvents:UIControlEventTouchUpInside];
    [self.detailView addSubview:self.buttonyfz];
    
    self.yfzdy =  [[UITextField alloc] initWithFrame:CGRectMake(12 + 50 + 20 + 100 + 20 + 20 + 10, 220 + 10, 80, 30)];
    self.yfzdy.placeholder = @"自定义";
    self.yfzdy.textAlignment = NSTextAlignmentCenter;
    self.yfzdy.font = [UIFont systemFontOfSize:15];
    self.yfzdy.delegate = self;
    self.yfzdy.keyboardType = UIKeyboardTypeNumberPad;
    [self.detailView addSubview:self.yfzdy];
    [self.yfzdy.layer setBorderWidth:1];
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    CGColorRef colorref = CGColorCreate(colorSpace, (CGFloat[]){0.3, 0.3, 0.3, 1});
    [self.yfzdy.layer setBorderColor:colorref];
    CGColorRelease(colorref);
    CGColorSpaceRelease(colorSpace);
    
    UILabel *ctribe = [[UILabel alloc] initWithFrame:CGRectMake(20, 270, 100, 50)];
    ctribe.text = @"选择部落:";
    ctribe.font = [FontTool fontWithSize:15];
    ctribe.textColor = [UIColor blackColor];
    ctribe.textAlignment = NSTextAlignmentLeft;
    [self.detailView addSubview:ctribe];
    
    UIImageView *arrow = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth - 18 - 24, 270 + 16, 18, 18)];
    arrow.image = [UIImage imageNamed:@"rightarrow"];
    [self.detailView addSubview:arrow];
    
    self.buttontribe = [UIButton buttonWithType:UIButtonTypeCustom];
    self.buttontribe.frame = CGRectMake(ScreenWidth - 24 - 18 - 100, 270, 100, 50);
    [self.buttontribe setTitle:@"请选择部落" forState:UIControlStateNormal];
    self.buttontribe.titleLabel.font = [UIFont systemFontOfSize:15];
    self.buttontribe.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
    [self.buttontribe setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.detailView addSubview:self.buttontribe];
    [self.buttontribe addTarget:self action:@selector(clickChooseTribe) forControlEvents:UIControlEventTouchUpInside];
    
    UILabel *mount = [[UILabel alloc] initWithFrame:CGRectMake(12, 320, 50, 50)];
    mount.text = @"库存:";
    mount.font = [FontTool fontWithSize:15];
    mount.textColor = [UIColor blackColor];
    mount.textAlignment = NSTextAlignmentCenter;
    [self.detailView addSubview:mount];
    
    UIButton *buttondel = [UIButton buttonWithType:UIButtonTypeCustom];
    buttondel.frame = CGRectMake(12 + 50 + 20, 330, 30, 30);
    [buttondel setTitle:@"-" forState:UIControlStateNormal];
    buttondel.titleLabel.font = [UIFont systemFontOfSize:15];
    buttondel.backgroundColor = [UIColor grayColor];
    buttondel.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [buttondel setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [buttondel addTarget:self action:@selector(clickMin) forControlEvents:UIControlEventTouchUpInside];
    [self.detailView addSubview:buttondel];
    
    self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(12 + 50 + 20 + 30 + 10, 320, 30, 50)];
    self.countLabel.text = @"1";
    self.countLabel.font = [FontTool fontWithSize:15];
    self.countLabel.textColor = [UIColor blackColor];
    self.countLabel.textAlignment = NSTextAlignmentCenter;
    [self.detailView addSubview:self.countLabel];
    
    UIButton *buttonadd = [UIButton buttonWithType:UIButtonTypeCustom];
    buttonadd.frame = CGRectMake(12 + 50 + 20 + 30 + 10 + 30 + 10, 330, 30, 30);
    [buttonadd setTitle:@"+" forState:UIControlStateNormal];
    buttonadd.titleLabel.font = [UIFont systemFontOfSize:15];
    buttonadd.backgroundColor = [UIColor grayColor];
    buttonadd.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [buttonadd setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [buttonadd addTarget:self action:@selector(clickAdd) forControlEvents:UIControlEventTouchUpInside];
    [self.detailView addSubview:buttonadd];
    
    UILabel *words = [[UILabel alloc] initWithFrame:CGRectMake(12, 370, 50, 50)];
    words.text = @"承诺:";
    words.font = [FontTool fontWithSize:15];
    words.textColor = [UIColor blackColor];
    words.textAlignment = NSTextAlignmentCenter;
    [self.detailView addSubview:words];
    
    self.buttoncl = [UIButton buttonWithType:UIButtonTypeCustom];
    self.buttoncl.frame = CGRectMake(12 + 50 + 20, 370, 200, 50);
    [self.buttoncl setTitle:@"七天无理由退换货" forState:UIControlStateNormal];
    self.buttoncl.titleLabel.font = [UIFont systemFontOfSize:15];
    self.buttoncl.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.buttoncl setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.buttoncl setImage:[UIImage imageNamed:@"选择默认地址图标"] forState:UIControlStateNormal];
    [self.detailView addSubview:self.buttoncl];
    
    self.buttonwen = [UIButton buttonWithType:UIButtonTypeCustom];
    self.buttonwen.frame = CGRectMake(ScreenWidth - 24 - 40, 370 + 15, 20, 20);
    [self.buttonwen setImage:[UIImage imageNamed:@"checkabout"] forState:UIControlStateNormal];
    [self.detailView addSubview:self.buttonwen];
}

- (void)textFieldDidEndEditing:(UITextField *)textField {
    if (self.tfprice.text.length > 0)
        [PublishData sharedPublishData].market_price = [self.tfprice.text floatValue];
        [PublishData sharedPublishData].start_price = [self.tfprice.text floatValue];
    if (self.yfzdy.text.length > 0)
        [PublishData sharedPublishData].product_yunfei = [self.yfzdy.text integerValue];
    if (self.addprice.text.length > 0) {
        [PublishData sharedPublishData].step_price = [self.addprice.text integerValue];
    }
}

- (void)makeAddView {
    self.addView = [[UIView alloc] initWithFrame:CGRectMake(0, 120, ScreenWidth, 150)];
    self.addView.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.addView];
    self.addView.userInteractionEnabled = YES;
    self.addView.hidden = YES;
    
    self.startLabel = [[UILabel alloc] initWithFrame:CGRectMake(12, 0, 80, 50)];
    self.startLabel.text = @"开始时间:";
    self.startLabel.font = [FontTool fontWithSize:15];
    self.startLabel.textColor = [UIColor blackColor];
    self.startLabel.textAlignment = NSTextAlignmentCenter;
    [self.addView addSubview:self.startLabel];
    
    self.startbutton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.startbutton.frame = CGRectMake(12 + 80, 0, 150, 50);
    [self.startbutton setTitle:@"" forState:UIControlStateNormal];
    self.startbutton.titleLabel.font = [UIFont systemFontOfSize:15];
    self.startbutton.backgroundColor = [UIColor whiteColor];
    self.startbutton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    [self.startbutton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.startbutton addTarget:self action:@selector(clickStartbutton) forControlEvents:UIControlEventTouchUpInside];
    [self.addView addSubview:self.startbutton];
    
    self.endLabel = [[UILabel alloc] initWithFrame:CGRectMake(12, 50, 80, 50)];
    self.endLabel.text = @"结束时间:";
    self.endLabel.font = [FontTool fontWithSize:15];
    self.endLabel.textColor = [UIColor blackColor];
    self.endLabel.textAlignment = NSTextAlignmentCenter;
    [self.addView addSubview:self.endLabel];
    
    self.endbutton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.endbutton.frame = CGRectMake(12 + 80, 50, 150, 50);
    [self.endbutton setTitle:@"" forState:UIControlStateNormal];
    self.endbutton.titleLabel.font = [UIFont systemFontOfSize:15];
    self.endbutton.backgroundColor = [UIColor whiteColor];
    self.endbutton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    [self.endbutton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.endbutton addTarget:self action:@selector(clickEndbutton) forControlEvents:UIControlEventTouchUpInside];
    [self.addView addSubview:self.endbutton];
    
    self.addLabel = [[UILabel alloc] initWithFrame:CGRectMake(12, 100, 80, 50)];
    self.addLabel.text = @"加价幅度:";
    self.addLabel.font = [FontTool fontWithSize:15];
    self.addLabel.textColor = [UIColor blackColor];
    self.addLabel.textAlignment = NSTextAlignmentCenter;
    [self.addView addSubview:self.addLabel];
    
    self.addprice =  [[UITextField alloc] initWithFrame:CGRectMake(12 + 80, 100, ScreenWidth - 12 - 12 - 80, 50)];
    self.addprice.placeholder =@"";
    self.addprice.textAlignment = NSTextAlignmentLeft;
    self.addprice.font = [UIFont systemFontOfSize:15];
    self.addprice.keyboardType = UIKeyboardTypeNumberPad;
    self.addprice.delegate = self;
    [self.addView addSubview:self.addprice];
}

- (void)makeDetailView {
    
}

- (void)clickYKJ {
    if ([DataCenter sharedDataCenter].detailType == PGoodDetailYKJ) {
        [DataCenter sharedDataCenter].detailType = PGoodDetailPM;
        [PublishData sharedPublishData].product_sell_type = @"1";
        [UIView animateWithDuration:0.2f delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
            self.detailView.transform = CGAffineTransformMakeTranslation(0, 150);
            self.buttonykj.transform = CGAffineTransformMakeTranslation(ScreenWidth - 40 - 40, 0);
            self.buttonykj.enabled = NO;
            self.addView.hidden = NO;
            
            if (self.controller) {
                PublishGoodViewController *pb = (PublishGoodViewController *)self.controller;
                [pb refreshTable];
            }
        } completion:^(BOOL finished) {
            self.buttonykj.enabled = YES;
            self.ykjLabel.textColor = [UIColor lightGrayColor];
            self.pmLabel.textColor = [UIColor blackColor];
        }];
    } else {
        [DataCenter sharedDataCenter].detailType = PGoodDetailYKJ;
        [PublishData sharedPublishData].product_sell_type = @"0";
        [UIView animateWithDuration:0.2f delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
            self.detailView.transform = CGAffineTransformIdentity;
            self.buttonykj.transform = CGAffineTransformIdentity;
            self.buttonykj.enabled = NO;
            self.addView.hidden = YES;
            
            if (self.controller) {
                PublishGoodViewController *pb = (PublishGoodViewController *)self.controller;
                [pb refreshTable];
            }
        } completion:^(BOOL finished) {
            self.buttonykj.enabled = YES;
            self.pmLabel.textColor = [UIColor lightGrayColor];
            self.ykjLabel.textColor = [UIColor blackColor];
        }];
    }
}

- (void)clickAdd {
    [PublishData sharedPublishData].product_kuchun += 1;
    self.countLabel.text = [NSString stringWithFormat:@"%ld", [PublishData sharedPublishData].product_kuchun];
}

- (void)clickMin {
    if ([PublishData sharedPublishData].product_kuchun > 1) {
        [PublishData sharedPublishData].product_kuchun -= 1;
        self.countLabel.text = [NSString stringWithFormat:@"%ld", [PublishData sharedPublishData].product_kuchun];
    }
}

#pragma mark - JGPickerViewDelegate -
-(void)getTimeToValue:(NSString *)theTimeStr {
    NSString *result = [theTimeStr stringByAppendingString:@":00"];
    if (self.timetype == 0) {
        [self.startbutton setTitle:result forState:UIControlStateNormal];
        [PublishData sharedPublishData].start_tm = result;
    } else {
        [self.endbutton setTitle:result forState:UIControlStateNormal];
        [PublishData sharedPublishData].end_tm = result;
    }
}

- (void)clickStartbutton {
    self.timetype = 0;
    FDAlertView *alert = [[FDAlertView alloc] init];
    RBCustomDatePickerView * contentView=[[RBCustomDatePickerView alloc] initWithFrame:CGRectMake(0, 0, 320, 300)];
    contentView.delegate=self;
    alert.contentView = contentView;
    [alert show];
}

- (void)clickEndbutton {
    self.timetype = 1;
    FDAlertView *alert = [[FDAlertView alloc] init];
    RBCustomDatePickerView * contentView=[[RBCustomDatePickerView alloc] initWithFrame:CGRectMake(0, 0, 320, 300)];
    contentView.delegate=self;
    alert.contentView = contentView;
    [alert show];
}

- (void)clickBaoyou {
    [self.buttonyf setImage:[UIImage imageNamed:@"选择默认地址图标"] forState:UIControlStateNormal];
    [self.buttonyfz setImage:[UIImage imageNamed:@"nocheck"] forState:UIControlStateNormal];
    [PublishData sharedPublishData].product_yunfei = 0;
}

- (void)clickZdyYunfei {
    [self.buttonyfz setImage:[UIImage imageNamed:@"选择默认地址图标"] forState:UIControlStateNormal];
    [self.buttonyf setImage:[UIImage imageNamed:@"nocheck"] forState:UIControlStateNormal];
    if (self.yfzdy.text.length > 0) {
        [PublishData sharedPublishData].product_yunfei = [self.yfzdy.text integerValue];
    } else {
        [PublishData sharedPublishData].product_yunfei = -1;
    }
}

- (void)clickFenlei {
    if (self.controller) {
        PublishGoodViewController *pb = (PublishGoodViewController *)self.controller;
        ChooseGoodTypeViewController *vc = [[ChooseGoodTypeViewController alloc] initWithNibName:@"ChooseGoodTypeViewController" bundle:nil];
        [pb.navigationController pushViewController:vc animated:YES];
    }
}

- (void)clickChooseTribe {
    if (self.controller) {
        PublishGoodViewController *pb = (PublishGoodViewController *)self.controller;
        [self.contentView endEditing:YES];
        MyAddTribeListViewController *vc = [[MyAddTribeListViewController alloc] initWithNibName:@"MyAddTribeListViewController" bundle:nil];
        vc.type = IMyAddTribeListChoose;
        [pb.navigationController pushViewController:vc animated:YES];
    }
}

- (void)choosetype:(NSNotification *)notify {
    if ([PublishData sharedPublishData].product_type_name)
        [self.buttonfenlei setTitle:[PublishData sharedPublishData].product_type_name forState:UIControlStateNormal];
}

- (void)choosetribe:(NSNotification *)notify {
    if ([PublishData sharedPublishData].chooseTribeName.length > 0) {
        [self.buttontribe setTitle:[PublishData sharedPublishData].chooseTribeName forState:UIControlStateNormal];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
